Saucedemo - Let's do it!

Report generated on 06-Dec-2022 at 15:33:48 by pytest-html v3.2.0

Environment

Packages {"pluggy": "1.0.0", "pytest": "7.2.0"}
Platform macOS-13.0-x86_64-i386-64bit
Plugins {"html": "3.2.0", "metadata": "2.0.4", "order": "1.0.1", "xdist": "3.0.2"}
Python 3.10.6

Summary

146 tests ran in 585.22 seconds.

89 passed, 0 skipped, 17 failed, 0 errors, 31 expected failures, 9 unexpected passes

Results

Result Test Duration Links
Failed tests/test_inventory_page.py::test_remove_item_from_the_cart[chrome] 0.17
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_remove_item_from_the_cart(d, correct_login):
page = InventoryPage(d, link)
> page.no_item_in_cart()

tests/test_inventory_page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f93dc00>

def no_item_in_cart(self):
> assert self.element_is_NOT_present(*InventoryPageLocators.CART_BADGE)
E AssertionError

pages/inventory_page.py:40: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_inventory_page.py::test_remove_item_from_the_cart[firefox] 0.15
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_remove_item_from_the_cart(d, correct_login):
page = InventoryPage(d, link)
> page.no_item_in_cart()

tests/test_inventory_page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10fa81390>

def no_item_in_cart(self):
> assert self.element_is_NOT_present(*InventoryPageLocators.CART_BADGE)
E AssertionError

pages/inventory_page.py:40: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_inventory_page.py::test_check_item_info[firefox] 1.17
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_check_item_info(d, correct_login):
> d.find_element(*InventoryPageLocators.FLEECE_JACKET_ADD_BTN).click()

tests/test_inventory_page.py:79:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-fleece-jacket"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_about_page_all_users[firefox-standard_user] 4.58
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_about_page_all_users(d, login_from_list):
d.find_element(*InventoryPageLocators.BURGER_BTN).click()
> d.find_element(*InventoryPageLocators.BURGER_MENU_ABOUT_BTN).click()

tests/test_widgets.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py:93: in click
self._execute(Command.CLICK_ELEMENT)
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webelement.py:410: in _execute
return self._parent.execute(command, params)
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 400, 'value': '{"value":{"error":"element not interactable","message":"element not interactable\\n (Sessio...ff80f1bb259 _pthread_start + 125\\n21 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x000000010438998a chromedriver + 440714
E 3 chromedriver 0x00000001043c80b3 chromedriver + 696499
E 4 chromedriver 0x00000001043baf01 chromedriver + 642817
E 5 chromedriver 0x00000001043e7d02 chromedriver + 826626
E 6 chromedriver 0x00000001043ba685 chromedriver + 640645
E 7 chromedriver 0x00000001043e7e5e chromedriver + 826974
E 8 chromedriver 0x0000000104400134 chromedriver + 926004
E 9 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 10 chromedriver 0x00000001043b89fd chromedriver + 633341
E 11 chromedriver 0x00000001043ba051 chromedriver + 639057
E 12 chromedriver 0x000000010477330e chromedriver + 4543246
E 13 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 14 chromedriver 0x000000010477f6df chromedriver + 4593375
E 15 chromedriver 0x00000001047788fa chromedriver + 4565242
E 16 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 17 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 18 chromedriver 0x0000000104797739 chromedriver + 4691769
E 19 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 20 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 21 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: ElementNotInteractableException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widget_FB[firefox] 4.75
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widget_FB(d, correct_login):
d.find_element(By.XPATH, '//a[contains(text(),"Facebook")]').click()
handles = d.window_handles
d.switch_to.window(handles[1])
url = d.current_url
> assert (
"https://www.facebook.com" in url and "saucelabs" in url
), "you are NOT on correct Facebook page"
E AssertionError: you are NOT on correct Facebook page
E assert ('https://www.facebook.com' in 'https://www.saucedemo.com/inventory.html')

tests/test_widgets.py:34: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_inventory_page[chrome] 4.64
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_inventory_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
page.open_page()
> page.all_widgets_on_page()

tests/test_widgets.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f76d030>

def all_widgets_on_page(self):
self.widgets = [
(Widgets.FB_WIDGET_ALL_PAGES, "https://www.facebook.com/", "saucelabs"),
(Widgets.TWITTER_WIDGET_ALL_PAGES, "https://twitter.com/", "saucelabs"),
(
Widgets.LINKEDIN_WIDGET_ALL_PAGES,
"https://www.linkedin.com/",
"sauce-labs",
),
]
n = 1
for loc, urls, urle in self.widgets:
self.d.find_element(*loc).click()
handles = self.d.window_handles
self.d.switch_to.window(handles[n])
> assert (
urls in self.d.current_url and urle in self.d.current_url
), "you are NOT on correct widget page"
E AssertionError: you are NOT on correct widget page

pages/base_page.py:45: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_inventory_page[firefox] 1.58
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_inventory_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
page.open_page()
> page.all_widgets_on_page()

tests/test_widgets.py:43:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10fab5660>

def all_widgets_on_page(self):
self.widgets = [
(Widgets.FB_WIDGET_ALL_PAGES, "https://www.facebook.com/", "saucelabs"),
(Widgets.TWITTER_WIDGET_ALL_PAGES, "https://twitter.com/", "saucelabs"),
(
Widgets.LINKEDIN_WIDGET_ALL_PAGES,
"https://www.linkedin.com/",
"sauce-labs",
),
]
n = 1
for loc, urls, urle in self.widgets:
self.d.find_element(*loc).click()
handles = self.d.window_handles
self.d.switch_to.window(handles[n])
> assert (
urls in self.d.current_url and urle in self.d.current_url
), "you are NOT on correct widget page"
E AssertionError: you are NOT on correct widget page

pages/base_page.py:45: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_inventory_item_page[chrome] 1.30
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_inventory_item_page(d, correct_login):
link = "https://www.saucedemo.com/inventory-item.html?id=4"
page = InventoryPage(d, link)
page.open_page()
> page.all_widgets_on_page()

tests/test_widgets.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f87db40>

def all_widgets_on_page(self):
self.widgets = [
(Widgets.FB_WIDGET_ALL_PAGES, "https://www.facebook.com/", "saucelabs"),
(Widgets.TWITTER_WIDGET_ALL_PAGES, "https://twitter.com/", "saucelabs"),
(
Widgets.LINKEDIN_WIDGET_ALL_PAGES,
"https://www.linkedin.com/",
"sauce-labs",
),
]
n = 1
for loc, urls, urle in self.widgets:
self.d.find_element(*loc).click()
handles = self.d.window_handles
self.d.switch_to.window(handles[n])
> assert (
urls in self.d.current_url and urle in self.d.current_url
), "you are NOT on correct widget page"
E AssertionError: you are NOT on correct widget page

pages/base_page.py:45: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_inventory_item_page[firefox] 1.57
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_inventory_item_page(d, correct_login):
link = "https://www.saucedemo.com/inventory-item.html?id=4"
page = InventoryPage(d, link)
page.open_page()
> page.all_widgets_on_page()

tests/test_widgets.py:50:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10fab66b0>

def all_widgets_on_page(self):
self.widgets = [
(Widgets.FB_WIDGET_ALL_PAGES, "https://www.facebook.com/", "saucelabs"),
(Widgets.TWITTER_WIDGET_ALL_PAGES, "https://twitter.com/", "saucelabs"),
(
Widgets.LINKEDIN_WIDGET_ALL_PAGES,
"https://www.linkedin.com/",
"sauce-labs",
),
]
n = 1
for loc, urls, urle in self.widgets:
self.d.find_element(*loc).click()
handles = self.d.window_handles
self.d.switch_to.window(handles[n])
> assert (
urls in self.d.current_url and urle in self.d.current_url
), "you are NOT on correct widget page"
E AssertionError: you are NOT on correct widget page

pages/base_page.py:45: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_cart_page[chrome] 1.71
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_cart_page(d, correct_login):
link = "https://www.saucedemo.com/cart.html"
page = InventoryPage(d, link)
page.open_page()
> page.all_widgets_on_page()

tests/test_widgets.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f87cfa0>

def all_widgets_on_page(self):
self.widgets = [
(Widgets.FB_WIDGET_ALL_PAGES, "https://www.facebook.com/", "saucelabs"),
(Widgets.TWITTER_WIDGET_ALL_PAGES, "https://twitter.com/", "saucelabs"),
(
Widgets.LINKEDIN_WIDGET_ALL_PAGES,
"https://www.linkedin.com/",
"sauce-labs",
),
]
n = 1
for loc, urls, urle in self.widgets:
self.d.find_element(*loc).click()
handles = self.d.window_handles
self.d.switch_to.window(handles[n])
> assert (
urls in self.d.current_url and urle in self.d.current_url
), "you are NOT on correct widget page"
E AssertionError: you are NOT on correct widget page

pages/base_page.py:45: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_cart_page[firefox] 2.30
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_cart_page(d, correct_login):
link = "https://www.saucedemo.com/cart.html"
page = InventoryPage(d, link)
page.open_page()
> page.all_widgets_on_page()

tests/test_widgets.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f70d660>

def all_widgets_on_page(self):
self.widgets = [
(Widgets.FB_WIDGET_ALL_PAGES, "https://www.facebook.com/", "saucelabs"),
(Widgets.TWITTER_WIDGET_ALL_PAGES, "https://twitter.com/", "saucelabs"),
(
Widgets.LINKEDIN_WIDGET_ALL_PAGES,
"https://www.linkedin.com/",
"sauce-labs",
),
]
n = 1
for loc, urls, urle in self.widgets:
self.d.find_element(*loc).click()
handles = self.d.window_handles
self.d.switch_to.window(handles[n])
> assert (
urls in self.d.current_url and urle in self.d.current_url
), "you are NOT on correct widget page"
E AssertionError: you are NOT on correct widget page

pages/base_page.py:45: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_checkout_step_one_page[chrome] 1.79
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_checkout_step_one_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
> page.add_to_cart_backpack()

tests/test_widgets.py:63:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:33: in add_to_cart_backpack
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_checkout_step_one_page[firefox] 1.84
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_checkout_step_one_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
> page.add_to_cart_backpack()

tests/test_widgets.py:63:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:33: in add_to_cart_backpack
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_checkout_step_two_page[chrome] 1.57
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_checkout_step_two_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
> page.add_to_cart_backpack()

tests/test_widgets.py:73:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:33: in add_to_cart_backpack
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_checkout_step_two_page[firefox] 1.81
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_checkout_step_two_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
> page.add_to_cart_backpack()

tests/test_widgets.py:73:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:33: in add_to_cart_backpack
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_checkout_complete_page[chrome] 1.61
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_checkout_complete_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
> page.add_to_cart_backpack()

tests/test_widgets.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:33: in add_to_cart_backpack
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Failed tests/test_widgets.py::test_widgets_checkout_complete_page[firefox] 1.62
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

def test_widgets_checkout_complete_page(d, correct_login):
link = "https://www.saucedemo.com/inventory.html"
page = InventoryPage(d, link)
> page.add_to_cart_backpack()

tests/test_widgets.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:33: in add_to_cart_backpack
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_cart_page.py::test_add_items[chrome-problem_user] 4.29
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f76e350>

def add_backpack_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_add_items(d, login_from_list):
page = InventoryPage(d, link_inv)
d.implicitly_wait(2)
> page.add_backpack_for_few_users()

tests/test_cart_page.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:134: in add_backpack_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_cart_page.py::test_add_items[firefox-problem_user] 4.27
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f804a00>

def add_backpack_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_add_items(d, login_from_list):
page = InventoryPage(d, link_inv)
d.implicitly_wait(2)
> page.add_backpack_for_few_users()

tests/test_cart_page.py:21:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:134: in add_backpack_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_cart_page.py::test_change_qty[firefox] 2.23
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

@pytest.mark.xfail(rises="NotWorking")
def test_change_qty(d, correct_login):
> d.find_element(By.ID, "add-to-cart-test.allthethings()-t-shirt-(red)").click()

tests/test_cart_page.py:35:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-test.allthethings()-t-shirt-(red)"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_cart_page.py::test_checkout_with_empty_cart[chrome] 0.20
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

@pytest.mark.xfail
def test_checkout_with_empty_cart(d, correct_login):
page = CartPage(d, link_inv)
page.go_to_the_cart()
> page.cart_is_empty()

tests/test_cart_page.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.cart_page.CartPage object at 0x10f8b51b0>

def cart_is_empty(self):
> assert self.element_is_NOT_present(*CartPageLocators.CART_ITEM_BLOCK)
E AssertionError

pages/cart_page.py:10: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_cart_page.py::test_checkout_with_empty_cart[firefox] 0.18
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

@pytest.mark.xfail
def test_checkout_with_empty_cart(d, correct_login):
page = CartPage(d, link_inv)
page.go_to_the_cart()
> page.cart_is_empty()

tests/test_cart_page.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.cart_page.CartPage object at 0x10f80abc0>

def cart_is_empty(self):
> assert self.element_is_NOT_present(*CartPageLocators.CART_ITEM_BLOCK)
E AssertionError

pages/cart_page.py:10: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_checkout[chrome-problem_user] 4.74
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8b5600>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8b5600>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_checkout(d, login_from_list):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="c887655c-f33e-451c-99ce-7020d87e7db6")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b579e1fe-9dc8-4add-a185-218fb4b7c46d")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="8195c9fe-e177-42cc-b23c-195ce5df4348")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="4c6b0e07-dfa2-4f8e-ab51-fbfde36426fc")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_checkout[firefox-problem_user] 4.33
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f93dc30>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f93dc30>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_checkout(d, login_from_list):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:48:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="870f1998-859f-48f0-bee5-94b493721eac")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="238ff1ea-bf97-400d-82a2-c730cebc9a80")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b7c0c917-5334-406a-ba32-de45a1741e69")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_checkout_with_data_inspection[chrome-problem_user] 0.81
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_checkout_with_data_inspection(d, login_from_list):
page = InventoryPage(d, link_inv)
page.add_items_to_cart_for_few_users()

"""создаем словарь ['name':'price'] из товаров, которые добавляем в корзину"""

items = d.find_elements(
By.XPATH,
"//*[@class='btn btn_secondary btn_small btn_inventory']/../../div[@class='inventory_item_label']/a",
)
keys_inventory = []
for k in items:
keys_inventory.append(k.text)
prices = d.find_elements(
By.XPATH, "//*[@class='btn btn_secondary btn_small btn_inventory']/../div"
)
values_inventory = []
for v in prices:
values_inventory.append(v.text)
dict_inventory = {
keys_inventory[i]: values_inventory[i] for i in range(len(keys_inventory))
}

"""go to cart page, then to chechout page"""

d.find_element(*InventoryPageLocators.CART_BTN).click()
assert (
"Sauce Labs Backpack"
and "Sauce Labs Bike Light"
and "Sauce Labs Onesie" in d.find_element(By.CLASS_NAME, "cart_list").text
)
d.find_element(*CartPageLocators.BT_CHECKOUT).click()
assert "checkout-step-one" in d.current_url, "---WRONG URL---"
page = CheckoutPage(d, link_checkout)
page.enter_checkout_info("Alice", "Smith", 78717)
> assert "checkout-step-two" in d.current_url, "---WRONG URL---"
E AssertionError: ---WRONG URL---
E assert 'checkout-step-two' in 'https://www.saucedemo.com/checkout-step-one.html'
E + where 'https://www.saucedemo.com/checkout-step-one.html' = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>.current_url

tests/test_checkout.py:104: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_checkout_with_data_inspection[firefox-problem_user] 0.57
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_checkout_with_data_inspection(d, login_from_list):
page = InventoryPage(d, link_inv)
page.add_items_to_cart_for_few_users()

"""создаем словарь ['name':'price'] из товаров, которые добавляем в корзину"""

items = d.find_elements(
By.XPATH,
"//*[@class='btn btn_secondary btn_small btn_inventory']/../../div[@class='inventory_item_label']/a",
)
keys_inventory = []
for k in items:
keys_inventory.append(k.text)
prices = d.find_elements(
By.XPATH, "//*[@class='btn btn_secondary btn_small btn_inventory']/../div"
)
values_inventory = []
for v in prices:
values_inventory.append(v.text)
dict_inventory = {
keys_inventory[i]: values_inventory[i] for i in range(len(keys_inventory))
}

"""go to cart page, then to chechout page"""

d.find_element(*InventoryPageLocators.CART_BTN).click()
assert (
"Sauce Labs Backpack"
and "Sauce Labs Bike Light"
and "Sauce Labs Onesie" in d.find_element(By.CLASS_NAME, "cart_list").text
)
d.find_element(*CartPageLocators.BT_CHECKOUT).click()
assert "checkout-step-one" in d.current_url, "---WRONG URL---"
page = CheckoutPage(d, link_checkout)
page.enter_checkout_info("Alice", "Smith", 78717)
> assert "checkout-step-two" in d.current_url, "---WRONG URL---"
E AssertionError: ---WRONG URL---
E assert 'checkout-step-two' in 'https://www.saucedemo.com/checkout-step-one.html'
E + where 'https://www.saucedemo.com/checkout-step-one.html' = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>.current_url

tests/test_checkout.py:104: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[chrome-standard_user-123-Smith-P456] 4.67
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '123'
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
page.add_items_to_cart_for_few_users()

page = CartPage(d, link_Cart)
d.implicitly_wait(2)
page.go_to_the_cart()
assert (
len(d.find_elements(By.CLASS_NAME, "cart_item")) == 3
), "---wrong number of elements---"
# assert ("Sauce Labs Backpack" and "Sauce Labs Bike Light" and "Sauce Labs Onesie"
# in d.find_element(By.CLASS_NAME, "cart_list").text
# )
d.find_element(*CartPageLocators.BT_CHECKOUT).click()
assert "checkout-step-one" in d.current_url

page = CheckoutPage(d, link_checkout)
page.enter_checkout_info(firstname, lastname, zip)
> assert d.find_element(By.CLASS_NAME, "error-button"), "---MUST BE ERROR BUTTON---"

tests/test_checkout.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".error-button"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="424163ed-8f42-47c4-a81b-3590d04bc9eb")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="2f33d6cb-2911-4c55-91ad-dd0ea9e35280")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="ffecbf53-def7-4f3f-b919-aadb84955125")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[chrome-problem_user-Alice-Smith-] 4.32
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8b66b0>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8b66b0>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = 'Alice'
lastname = 'Smith', zip = ''

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="ec1da045-56a0-4db4-b93b-e6767aca87b3")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="69ccdd89-17f0-4397-97ca-c8cbcd9807f7")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="4a5527e0-02d5-4fc9-b045-752c256187e0")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[chrome-problem_user-Alice--P456] 4.30
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f87cf40>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f87cf40>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = 'Alice'
lastname = '', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="73d7af12-3867-48fc-a397-4c5229d5ec07")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="7ba46385-fe77-4e7d-9853-24af0ddb9630")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="f3fd12aa-3194-4c12-bc6a-2c3201015c1a")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[chrome-problem_user--Smith-P456] 4.33
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f81d6f0>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f81d6f0>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = ''
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="f9f4fb88-3c5f-4508-b1b0-4656818cd921")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="6271f5e0-ebeb-4d42-a23b-ae8de7dccbc7")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="f3d3ba5e-9870-4d74-af9a-e51ddb28791d")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[chrome-problem_user---] 4.36
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f951c60>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f951c60>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '', lastname = ''
zip = ''

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b88c8006-a17b-4db7-9b41-993bf5f57782")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="a0a16158-38aa-4e44-963f-87a2e11cd4b7")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="232347f9-f143-4fe3-8751-1cd976312f1d")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[chrome-problem_user-123-Smith-P456] 4.30
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f81d750>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f81d750>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '123'
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="00d5ec1b-532a-4493-beaf-0c53c22df5ce")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="cb61d4ca-5ff7-43c4-a865-cc4992948e19")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="12f6b140-fff4-414f-bf43-7a3dc9b36207")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[chrome-performance_glitch_user-123-Smith-P456] 9.68
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '123'
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
page.add_items_to_cart_for_few_users()

page = CartPage(d, link_Cart)
d.implicitly_wait(2)
page.go_to_the_cart()
assert (
len(d.find_elements(By.CLASS_NAME, "cart_item")) == 3
), "---wrong number of elements---"
# assert ("Sauce Labs Backpack" and "Sauce Labs Bike Light" and "Sauce Labs Onesie"
# in d.find_element(By.CLASS_NAME, "cart_list").text
# )
d.find_element(*CartPageLocators.BT_CHECKOUT).click()
assert "checkout-step-one" in d.current_url

page = CheckoutPage(d, link_checkout)
page.enter_checkout_info(firstname, lastname, zip)
> assert d.find_element(By.CLASS_NAME, "error-button"), "---MUST BE ERROR BUTTON---"

tests/test_checkout.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".error-button"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="8ecbf7d7-4d94-439f-ad39-96e32fe15158")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="64eab713-f09f-4f7e-baa8-f019059757e0")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="2501a18d-f282-45d4-bf33-b30887258ff9")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[firefox-standard_user-123-Smith-P456] 4.65
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '123'
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
page.add_items_to_cart_for_few_users()

page = CartPage(d, link_Cart)
d.implicitly_wait(2)
page.go_to_the_cart()
assert (
len(d.find_elements(By.CLASS_NAME, "cart_item")) == 3
), "---wrong number of elements---"
# assert ("Sauce Labs Backpack" and "Sauce Labs Bike Light" and "Sauce Labs Onesie"
# in d.find_element(By.CLASS_NAME, "cart_list").text
# )
d.find_element(*CartPageLocators.BT_CHECKOUT).click()
assert "checkout-step-one" in d.current_url

page = CheckoutPage(d, link_checkout)
page.enter_checkout_info(firstname, lastname, zip)
> assert d.find_element(By.CLASS_NAME, "error-button"), "---MUST BE ERROR BUTTON---"

tests/test_checkout.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".error-button"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="42e4a8bf-829f-4a95-afc4-aceab97fd45f")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="150d5498-6e12-43bc-afa3-0b89cbc05921")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="7d7d51e0-7e30-41ed-8208-b6fa96b872a5")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[firefox-problem_user-Alice-Smith-] 4.31
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8e87f0>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8e87f0>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = 'Alice'
lastname = 'Smith', zip = ''

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="f7f3eec6-0d54-47ec-b6eb-acf3b19a4d20")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="a6b96f14-e8ca-4191-a808-bc4886fdb2a4")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="74bebd38-8e2c-4f1c-aba1-e810ba793d32")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[firefox-problem_user-Alice--P456] 4.34
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8eb220>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8eb220>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = 'Alice'
lastname = '', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="0b37f2f4-e32e-44b5-a89f-8f2f9e8a4e4e")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="1865915b-1923-4615-abf8-6aabd9f29a76")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="fa3b21da-7c92-49e2-9716-f408e49df667")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[firefox-problem_user--Smith-P456] 4.31
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8fc160>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8fc160>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = ''
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="7d2f927e-61f9-41a8-8314-010cc348c6ec")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="50bd9750-787e-42d5-a24d-1a253a448a8e")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="aa8224f0-9644-4a55-968d-34a665940a91")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[firefox-problem_user---] 4.35
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8fd930>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8fd930>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '', lastname = ''
zip = ''

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="9549474a-c135-4c0e-801e-85fdfa12d96a")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="d303d288-476d-4202-a0fe-16c59dcdb65b")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="73a9c5ba-7076-4ce9-bdf0-860138b93c3a")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[firefox-problem_user-123-Smith-P456] 4.36
self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8fca90>

def add_items_to_cart_for_few_users(self):
"""добавляем исключение из-за бага с мигрирующей корзиной"""
try:
> self.add_to_cart_backpack_inventory_item()

pages/inventory_page.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f8fca90>

def add_to_cart_backpack_inventory_item(self):
> self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()

pages/inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, by = 'css selector'
value = '[id="add-to-cart-sauce-labs-backpack"]'

def find_element(self, by=By.ID, value: Optional[str] = None) -> WebElement:
"""
Find an element given a By strategy and locator.

:Usage:
::

element = driver.find_element(By.ID, 'foo')

:rtype: WebElement
"""
if isinstance(by, RelativeBy):
elements = self.find_elements(by=by, value=value)
if not elements:
raise NoSuchElementException(f"Cannot locate relative element with: {by.root}")
return elements[0]

if by == By.ID:
by = By.CSS_SELECTOR
value = '[id="%s"]' % value
elif by == By.CLASS_NAME:
by = By.CSS_SELECTOR
value = ".%s" % value
elif by == By.NAME:
by = By.CSS_SELECTOR
value = '[name="%s"]' % value

> return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, driver_command = 'findElement'
params = {'using': 'css selector', 'value': '[id="add-to-cart-sauce-labs-backpack"]'}

def execute(self, driver_command: str, params: dict = None) -> dict:
"""
Sends a command to be executed by a command.CommandExecutor.

:Args:
- driver_command: The name of the command to execute as a string.
- params: A dictionary of named parameters to send with the command.

:Returns:
The command's JSON response loaded into a dictionary object.
"""
params = self._wrap_value(params)

if self.session_id:
if not params:
params = {"sessionId": self.session_id}
elif "sessionId" not in params:
params["sessionId"] = self.session_id

response = self.command_executor.execute(driver_command, params)
if response:
> self.error_handler.check_response(response)

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException

During handling of the above exception, another exception occurred:

d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '123'
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
> page.add_items_to_cart_for_few_users()

tests/test_checkout.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pages/inventory_page.py:118: in add_items_to_cart_for_few_users
self.add_to_cart_backpack_inventory_item()
pages/inventory_page.py:11: in add_to_cart_backpack_inventory_item
self.d.find_element(*InventoryPageLocators.BACKPACK_ADD_BTN).click()
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="f23d0b7e-215d-4827-bf91-9facc8e9f994")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="912e7404-3a19-4788-8c7b-abfaa96fa520")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b54f1614-d4b1-4f44-aeff-5ae65c53c262")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_checkout.py::test_negativ_checkout_data[firefox-performance_glitch_user-123-Smith-P456] 9.68
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None, firstname = '123'
lastname = 'Smith', zip = 'P456'

@pytest.mark.parametrize(
"firstname, lastname, zip",
[
("Alice", "Smith", ""),
("Alice", "", "P456"),
("", "Smith", "P456"),
("", "", ""),
pytest.param("123", "Smith", "P456", marks=pytest.mark.xfail),
],
)
def test_negativ_checkout_data(d, login_from_list, firstname, lastname, zip):
page = InventoryPage(d, link_inv)
page.add_items_to_cart_for_few_users()

page = CartPage(d, link_Cart)
d.implicitly_wait(2)
page.go_to_the_cart()
assert (
len(d.find_elements(By.CLASS_NAME, "cart_item")) == 3
), "---wrong number of elements---"
# assert ("Sauce Labs Backpack" and "Sauce Labs Bike Light" and "Sauce Labs Onesie"
# in d.find_element(By.CLASS_NAME, "cart_list").text
# )
d.find_element(*CartPageLocators.BT_CHECKOUT).click()
assert "checkout-step-one" in d.current_url

page = CheckoutPage(d, link_checkout)
page.enter_checkout_info(firstname, lastname, zip)
> assert d.find_element(By.CLASS_NAME, "error-button"), "---MUST BE ERROR BUTTON---"

tests/test_checkout.py:191:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".error-button"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="207799e7-411a-42ae-981d-e2166dcc3038")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="486459df-0f0e-478f-9c58-a50115c8102f")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="d5c4d18b-00d8-4a96-a103-830aa1086252")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_inventory_page.py::test_sort_items_az_za_lowhigh_highlow_all_users[chrome-problem_user] 8.52
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_sort_items_az_za_lowhigh_highlow_all_users(d, login_from_list):
page = InventoryPage(d, link)
> page.sort_items_on_inventory_page_az_za()

tests/test_inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f93da20>

def sort_items_on_inventory_page_az_za(self):
unsortedlist = self.d.find_elements(By.CSS_SELECTOR, ".inventory_item_name")
unsortedfinal = []
for x in unsortedlist:
unsortedfinal.append(x.text)
unsortedfinal.sort()
print(unsortedfinal)
self.d.find_element(*InventoryPageLocators.SORT_MENU_BUTTON).click()
time.sleep(2)
self.d.find_element(*InventoryPageLocators.SORT_OPTION_BUTTON_AZ).click()
time.sleep(2)
sortedlistaz = self.d.find_elements(By.CSS_SELECTOR, ".inventory_item_name")
sortedazfinal = []
for i in sortedlistaz:
sortedazfinal.append(i.text)
print(sortedazfinal)
self.d.find_element(*InventoryPageLocators.SORT_MENU_BUTTON).click()
time.sleep(2)
self.d.find_element(*InventoryPageLocators.SORT_OPTION_BUTTON_ZA).click()
time.sleep(2)
sortedlistza = self.d.find_elements(By.CSS_SELECTOR, ".inventory_item_name")
sortedzafinal = []
for p in sortedlistza:
sortedzafinal.append(p.text)
print(sortedzafinal)
sortedzafinal.reverse()
print(sortedzafinal)
assert sortedazfinal == unsortedfinal
> assert sortedazfinal == sortedzafinal
E AssertionError

pages/inventory_page.py:77: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Test.allTheThings() T-Shirt (Red)', 'Sauce Labs Onesie', 'Sauce Labs Fleece Jacket', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Bike Light', 'Sauce Labs Backpack']
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_inventory_page.py::test_sort_items_az_za_lowhigh_highlow_all_users[firefox-problem_user] 8.55
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_sort_items_az_za_lowhigh_highlow_all_users(d, login_from_list):
page = InventoryPage(d, link)
> page.sort_items_on_inventory_page_az_za()

tests/test_inventory_page.py:11:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <Saucedemo.pages.inventory_page.InventoryPage object at 0x10f88ce50>

def sort_items_on_inventory_page_az_za(self):
unsortedlist = self.d.find_elements(By.CSS_SELECTOR, ".inventory_item_name")
unsortedfinal = []
for x in unsortedlist:
unsortedfinal.append(x.text)
unsortedfinal.sort()
print(unsortedfinal)
self.d.find_element(*InventoryPageLocators.SORT_MENU_BUTTON).click()
time.sleep(2)
self.d.find_element(*InventoryPageLocators.SORT_OPTION_BUTTON_AZ).click()
time.sleep(2)
sortedlistaz = self.d.find_elements(By.CSS_SELECTOR, ".inventory_item_name")
sortedazfinal = []
for i in sortedlistaz:
sortedazfinal.append(i.text)
print(sortedazfinal)
self.d.find_element(*InventoryPageLocators.SORT_MENU_BUTTON).click()
time.sleep(2)
self.d.find_element(*InventoryPageLocators.SORT_OPTION_BUTTON_ZA).click()
time.sleep(2)
sortedlistza = self.d.find_elements(By.CSS_SELECTOR, ".inventory_item_name")
sortedzafinal = []
for p in sortedlistza:
sortedzafinal.append(p.text)
print(sortedzafinal)
sortedzafinal.reverse()
print(sortedzafinal)
assert sortedazfinal == unsortedfinal
> assert sortedazfinal == sortedzafinal
E AssertionError

pages/inventory_page.py:77: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Test.allTheThings() T-Shirt (Red)', 'Sauce Labs Onesie', 'Sauce Labs Fleece Jacket', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Bike Light', 'Sauce Labs Backpack']
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_inventory_page.py::test_product_cart_new_page[chrome-problem_user] 0.20
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_product_cart_new_page(d, login_from_list):
d.maximize_window()
achains = ActionChains(d)
backpack = d.find_element(*InventoryPageLocators.BACKPACK_LINK).click()
achains.context_click(backpack).perform()
d.implicitly_wait(1)
achains.context_click(backpack).send_keys(Keys.ARROW_DOWN).send_keys(
Keys.RETURN
).perform()
> assert d.current_url == "https://www.saucedemo.com/inventory-item.html?id=4"
E AssertionError: assert 'https://www.saucedemo.com/inventory-item.html?id=5' == 'https://www.saucedemo.com/inventory-item.html?id=4'
E - https://www.saucedemo.com/inventory-item.html?id=4
E ? ^
E + https://www.saucedemo.com/inventory-item.html?id=5
E ? ^

tests/test_inventory_page.py:24: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_inventory_page.py::test_product_cart_new_page[firefox-problem_user] 0.22
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_product_cart_new_page(d, login_from_list):
d.maximize_window()
achains = ActionChains(d)
backpack = d.find_element(*InventoryPageLocators.BACKPACK_LINK).click()
achains.context_click(backpack).perform()
d.implicitly_wait(1)
achains.context_click(backpack).send_keys(Keys.ARROW_DOWN).send_keys(
Keys.RETURN
).perform()
> assert d.current_url == "https://www.saucedemo.com/inventory-item.html?id=4"
E AssertionError: assert 'https://www.saucedemo.com/inventory-item.html?id=5' == 'https://www.saucedemo.com/inventory-item.html?id=4'
E - https://www.saucedemo.com/inventory-item.html?id=4
E ? ^
E + https://www.saucedemo.com/inventory-item.html?id=5
E ? ^

tests/test_inventory_page.py:24: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_widgets.py::test_about_page_all_users[chrome-problem_user] 10.72
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_about_page_all_users(d, login_from_list):
d.find_element(*InventoryPageLocators.BURGER_BTN).click()
d.find_element(*InventoryPageLocators.BURGER_MENU_ABOUT_BTN).click()
> assert d.current_url == "https://saucelabs.com/"
E AssertionError: assert 'https://saucelabs.com/error/404' == 'https://saucelabs.com/'
E - https://saucelabs.com/
E + https://saucelabs.com/error/404
E ? +++++++++

tests/test_widgets.py:15: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_widgets.py::test_about_page_all_users[firefox-problem_user] 3.09
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, login_from_list = None

def test_about_page_all_users(d, login_from_list):
d.find_element(*InventoryPageLocators.BURGER_BTN).click()
d.find_element(*InventoryPageLocators.BURGER_MENU_ABOUT_BTN).click()
> assert d.current_url == "https://saucelabs.com/"
E AssertionError: assert 'https://saucelabs.com/error/404' == 'https://saucelabs.com/'
E - https://saucelabs.com/
E + https://saucelabs.com/error/404
E ? +++++++++

tests/test_widgets.py:15: AssertionError
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_widgets.py::test_reset_app[chrome] 4.90
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

@pytest.mark.xfail(rises="NotReset")
def test_reset_app(d, correct_login):
> d.find_element(By.ID, "add-to-cart-sauce-labs-backpack").click()

tests/test_widgets.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XFailed tests/test_widgets.py::test_reset_app[firefox] 1.41
d = <selenium.webdriver.chrome.webdriver.WebDriver (session="3b00c91fa8795e0ce4d6c28b5b7b22e1")>, correct_login = None

@pytest.mark.xfail(rises="NotReset")
def test_reset_app(d, correct_login):
> d.find_element(By.ID, "add-to-cart-sauce-labs-backpack").click()

tests/test_widgets.py:20:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:861: in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:444: in execute
self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x10f76f5e0>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"no such element: Unable to locate element: {\...ff80f1bb259 _pthread_start + 125\\n20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15\\n"}}'}

def check_response(self, response: Dict[str, Any]) -> None:
"""
Checks that a JSON response from the WebDriver does not have an error.

:Args:
- response - The JSON response from the WebDriver server as a dictionary
object.

:Raises: If the response contains an error message.
"""
status = response.get("status", None)
if not status or status == ErrorCode.SUCCESS:
return
value = None
message = response.get("message", "")
screen: str = response.get("screen", "")
stacktrace = None
if isinstance(status, int):
value_json = response.get("value", None)
if value_json and isinstance(value_json, str):
import json

try:
value = json.loads(value_json)
if len(value.keys()) == 1:
value = value["value"]
status = value.get("error", None)
if not status:
status = value.get("status", ErrorCode.UNKNOWN_ERROR)
message = value.get("value") or value.get("message")
if not isinstance(message, str):
value = message
message = message.get("message")
else:
message = value.get("message", None)
except ValueError:
pass

exception_class: Type[WebDriverException]
if status in ErrorCode.NO_SUCH_ELEMENT:
exception_class = NoSuchElementException
elif status in ErrorCode.NO_SUCH_FRAME:
exception_class = NoSuchFrameException
elif status in ErrorCode.NO_SUCH_SHADOW_ROOT:
exception_class = NoSuchShadowRootException
elif status in ErrorCode.NO_SUCH_WINDOW:
exception_class = NoSuchWindowException
elif status in ErrorCode.STALE_ELEMENT_REFERENCE:
exception_class = StaleElementReferenceException
elif status in ErrorCode.ELEMENT_NOT_VISIBLE:
exception_class = ElementNotVisibleException
elif status in ErrorCode.INVALID_ELEMENT_STATE:
exception_class = InvalidElementStateException
elif (
status in ErrorCode.INVALID_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR
or status in ErrorCode.INVALID_XPATH_SELECTOR_RETURN_TYPER
):
exception_class = InvalidSelectorException
elif status in ErrorCode.ELEMENT_IS_NOT_SELECTABLE:
exception_class = ElementNotSelectableException
elif status in ErrorCode.ELEMENT_NOT_INTERACTABLE:
exception_class = ElementNotInteractableException
elif status in ErrorCode.INVALID_COOKIE_DOMAIN:
exception_class = InvalidCookieDomainException
elif status in ErrorCode.UNABLE_TO_SET_COOKIE:
exception_class = UnableToSetCookieException
elif status in ErrorCode.TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.SCRIPT_TIMEOUT:
exception_class = TimeoutException
elif status in ErrorCode.UNKNOWN_ERROR:
exception_class = WebDriverException
elif status in ErrorCode.UNEXPECTED_ALERT_OPEN:
exception_class = UnexpectedAlertPresentException
elif status in ErrorCode.NO_ALERT_OPEN:
exception_class = NoAlertPresentException
elif status in ErrorCode.IME_NOT_AVAILABLE:
exception_class = ImeNotAvailableException
elif status in ErrorCode.IME_ENGINE_ACTIVATION_FAILED:
exception_class = ImeActivationFailedException
elif status in ErrorCode.MOVE_TARGET_OUT_OF_BOUNDS:
exception_class = MoveTargetOutOfBoundsException
elif status in ErrorCode.JAVASCRIPT_ERROR:
exception_class = JavascriptException
elif status in ErrorCode.SESSION_NOT_CREATED:
exception_class = SessionNotCreatedException
elif status in ErrorCode.INVALID_ARGUMENT:
exception_class = InvalidArgumentException
elif status in ErrorCode.NO_SUCH_COOKIE:
exception_class = NoSuchCookieException
elif status in ErrorCode.UNABLE_TO_CAPTURE_SCREEN:
exception_class = ScreenshotException
elif status in ErrorCode.ELEMENT_CLICK_INTERCEPTED:
exception_class = ElementClickInterceptedException
elif status in ErrorCode.INSECURE_CERTIFICATE:
exception_class = InsecureCertificateException
elif status in ErrorCode.INVALID_COORDINATES:
exception_class = InvalidCoordinatesException
elif status in ErrorCode.INVALID_SESSION_ID:
exception_class = InvalidSessionIdException
elif status in ErrorCode.UNKNOWN_METHOD:
exception_class = UnknownMethodException
else:
exception_class = WebDriverException
if not value:
value = response["value"]
if isinstance(value, str):
raise exception_class(value)
if message == "" and "message" in value:
message = value["message"]

screen = None # type: ignore[assignment]
if "screen" in value:
screen = value["screen"]

stacktrace = None
st_value = value.get("stackTrace") or value.get("stacktrace")
if st_value:
if isinstance(st_value, str):
stacktrace = st_value.split("\n")
else:
stacktrace = []
try:
for frame in st_value:
line = frame.get("lineNumber", "")
file = frame.get("fileName", "<anonymous>")
if line:
file = f"{file}:{line}"
meth = frame.get("methodName", "<anonymous>")
if "className" in frame:
meth = "{}.{}".format(frame["className"], meth)
msg = " at %s (%s)"
msg = msg % (meth, file)
stacktrace.append(msg)
except TypeError:
pass
if exception_class == UnexpectedAlertPresentException:
alert_text = None
if "data" in value:
alert_text = value["data"].get("text")
elif "alert" in value:
alert_text = value["alert"].get("text")
raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here
> raise exception_class(message, screen, stacktrace)
E selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="add-to-cart-sauce-labs-backpack"]"}
E (Session info: headless chrome=107.0.5304.121)
E Stacktrace:
E 0 chromedriver 0x00000001047a62c8 chromedriver + 4752072
E 1 chromedriver 0x0000000104726463 chromedriver + 4228195
E 2 chromedriver 0x0000000104389b18 chromedriver + 441112
E 3 chromedriver 0x00000001043c6e21 chromedriver + 691745
E 4 chromedriver 0x00000001043c7061 chromedriver + 692321
E 5 chromedriver 0x00000001044025e4 chromedriver + 935396
E 6 chromedriver 0x00000001043e7d2d chromedriver + 826669
E 7 chromedriver 0x0000000104400134 chromedriver + 926004
E 8 chromedriver 0x00000001043e7b33 chromedriver + 826163
E 9 chromedriver 0x00000001043b89fd chromedriver + 633341
E 10 chromedriver 0x00000001043ba051 chromedriver + 639057
E 11 chromedriver 0x000000010477330e chromedriver + 4543246
E 12 chromedriver 0x0000000104777a88 chromedriver + 4561544
E 13 chromedriver 0x000000010477f6df chromedriver + 4593375
E 14 chromedriver 0x00000001047788fa chromedriver + 4565242
E 15 chromedriver 0x000000010474e2cf chromedriver + 4391631
E 16 chromedriver 0x00000001047975b8 chromedriver + 4691384
E 17 chromedriver 0x0000000104797739 chromedriver + 4691769
E 18 chromedriver 0x00000001047ad81e chromedriver + 4782110
E 19 libsystem_pthread.dylib 0x00007ff80f1bb259 _pthread_start + 125
E 20 libsystem_pthread.dylib 0x00007ff80f1b6c7b thread_start + 15

../../Library/Caches/pypoetry/virtualenvs/pyletsdoit-team-xN_ghUtV-py3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py:249: NoSuchElementException
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_cart_page.py::test_open_cart[chrome-problem_user] 0.53
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_cart_page.py::test_open_cart[firefox-problem_user] 0.33
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_cart_page.py::test_remove_items_from_cart_on_cart_page[chrome-problem_user] 2.35
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_cart_page.py::test_remove_items_from_cart_on_cart_page[firefox-problem_user] 2.32
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_cart_page.py::test_change_qty[chrome] 0.37
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_inventory_page.py::test_return_from_itempage[chrome-problem_user] 0.24
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_inventory_page.py::test_return_from_itempage[firefox-problem_user] 0.23
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_login_page.py::test_signin_using_a_list_of_credentials[chrome-problem_user] 0.18
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
XPassed tests/test_login_page.py::test_signin_using_a_list_of_credentials[firefox-problem_user] 0.18
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_open_cart[chrome-standard_user] 8.43
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_open_cart[chrome-performance_glitch_user] 12.99
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_open_cart[firefox-standard_user] 0.29
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_open_cart[firefox-performance_glitch_user] 10.32
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_add_items[chrome-standard_user] 0.43
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_add_items[chrome-performance_glitch_user] 7.41
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_add_items[firefox-standard_user] 2.29
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_add_items[firefox-performance_glitch_user] 7.34
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_remove_items_from_cart_on_cart_page[chrome-standard_user] 4.34
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_remove_items_from_cart_on_cart_page[chrome-performance_glitch_user] 7.37
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_remove_items_from_cart_on_cart_page[firefox-standard_user] 2.38
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_cart_page.py::test_remove_items_from_cart_on_cart_page[firefox-performance_glitch_user] 7.36
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout[chrome-standard_user] 1.17
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout[chrome-performance_glitch_user] 7.74
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="13627bd9-ded5-4dbd-9b39-062e3e2016f9")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="dd2da350-0212-4eee-8a04-6526b39b893f")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="1295978d-6a9b-4807-afef-0a55f36c367f")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout[firefox-standard_user] 2.72
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="e5d7980c-e2e7-4f58-a2a2-7ff4375770aa")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="5ac6eec3-552b-4d4c-a16d-1299b6682a7a")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="da2b82e7-b6d0-448b-ad8d-70452eb3f562")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout[firefox-performance_glitch_user] 7.75
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="d1f30772-6d37-44e3-8f96-6d192cc70ad6")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="f1f2365c-2441-451c-8875-7953ed61b0ef")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="da78f828-2829-4672-b7d1-a7ffa9cacce4")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout_with_data_inspection[chrome-standard_user] 2.94
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="2790cb19-043c-4f52-98e1-0634937d1ed2")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="4bb472a8-8134-4954-b82d-cfb1b5305d69")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="aa6dfad2-b56f-460d-a052-b54b874d5da5")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout_with_data_inspection[chrome-performance_glitch_user] 13.09
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="0cc2073a-b947-4546-85a2-ab11591f5c6b")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="ffe84be9-2bec-4432-b6cf-e581d7fb5a36")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="11346b4a-21f1-4aca-bc0e-275169323830")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout_with_data_inspection[firefox-standard_user] 0.77
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_checkout_with_data_inspection[firefox-performance_glitch_user] 12.96
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="74340cd4-1b1e-4fdb-bdbb-9da5af1712cf")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="84c3ecca-0acd-48c6-9fc6-ae636cc0c8a3")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="13724051-7c3f-47ec-ba7d-1810ca5f647f")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-standard_user-Alice-Smith-] 0.54
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-standard_user-Alice--P456] 2.66
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="1d626023-4f4d-4501-b6b6-a5448ab2ab36")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="13848a14-5ab7-4c57-b4e4-6b340d5113ce")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="90deab74-ae78-4b10-adac-556cfc99c18a")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-standard_user--Smith-P456] 2.65
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="56b05b71-4918-4022-b519-5e41939fa58c")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="8616081a-8daf-4984-8a1f-3ab92214d0f5")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="17780e73-5925-4c6e-bd46-79ee53ce69d1")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-standard_user---] 2.63
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="8d04c959-ad4c-4711-b355-435a50cb47f8")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="d8c2ea65-089e-45cd-a232-97dd6eb7b417")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="8440e963-02a4-47e6-acae-fd22c2e360df")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-performance_glitch_user-Alice-Smith-] 7.72
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="e2963f96-a1cd-4842-9306-da57769e3213")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="2ac9044e-7df6-49ea-8ebb-065886ae2e1c")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="e5777e56-614d-421c-9cd0-8b148194bebb")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-performance_glitch_user-Alice--P456] 7.60
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="bc6296f3-cccb-453a-8591-9006e0347ffe")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="213bd68e-ce06-4696-bd47-6cc38460ba84")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="5db84179-5825-4c98-b9d0-f75967feb549")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-performance_glitch_user--Smith-P456] 7.60
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b8241130-d383-4628-99fb-955620650fee")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b8839a46-bde7-4960-9596-d2fcbce0f3bc")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="f9efe989-4eff-4620-a283-3930ff34016a")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[chrome-performance_glitch_user---] 7.64
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="4f1a54ee-6f2f-4cd2-a3e6-bbf927c9aa34")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="8e7f3ba8-92d2-4977-b576-468314755b40")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="e38e37c5-6619-431d-a787-5f8d8e31fcc3")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-standard_user-Alice-Smith-] 2.70
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="9dc9ed35-8abd-4b6c-8844-aa7d4fdfefe6")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="e792e686-d2c3-4aa1-b643-b0e29308d197")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b5331ddb-6da3-424c-842c-5165fcf855a8")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-standard_user-Alice--P456] 2.62
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="7af3da28-f519-458f-9376-d951002ca8f7")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="c0052f82-021c-41c0-b17b-a70e64480213")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="b881c035-c129-415d-813b-8f7bbda7a067")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-standard_user--Smith-P456] 2.65
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="01b44b5d-900b-4ac5-83dc-e4265aaf9183")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="c73a5aed-3df1-44e6-b900-587dbf930179")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="2d438488-97f7-4fb4-9235-358b5cd72294")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-standard_user---] 2.68
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="d1dc0f29-7989-43bb-8cd4-7748d1a6f30f")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="09967268-5b18-444d-9367-36e75eec2162")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="db09cce2-5638-4aff-b678-2fbad16c6013")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-performance_glitch_user-Alice-Smith-] 7.70
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="362b7f67-a157-4268-beaf-05b4ac823321")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="6e130efd-ae93-491f-bf05-f2f993433023")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="59326e29-1151-4b67-ba9e-b4210b151e72")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-performance_glitch_user-Alice--P456] 7.64
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="af542dae-ef08-47be-9471-016bf1827dca")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="ad84505d-86a7-4fd0-a57f-77540b07d1a4")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="26a4dbb7-2aa7-49fc-aab1-eb8a26d5f35a")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-performance_glitch_user--Smith-P456] 7.63
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="3cd72f09-8044-4f9e-aa24-c6ae3d0d64aa")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="ab9015d5-734f-4b32-9e1e-b218e3c5854d")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="ad906393-1417-4749-98e2-9e76a8b24cc2")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_checkout.py::test_negativ_checkout_data[firefox-performance_glitch_user---] 7.71
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
[<selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="277e004d-abc8-4ff0-91ba-7989e742b277")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="716977c6-a153-4226-a077-0367d531513d")>, <selenium.webdriver.remote.webelement.WebElement (session="3b00c91fa8795e0ce4d6c28b5b7b22e1", element="be04264f-9d4b-4e48-9f8c-3d0a121a73d8")>]
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_sort_items_az_za_lowhigh_highlow_all_users[chrome-standard_user] 12.82
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Test.allTheThings() T-Shirt (Red)', 'Sauce Labs Onesie', 'Sauce Labs Fleece Jacket', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Bike Light', 'Sauce Labs Backpack'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)']
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_sort_items_az_za_lowhigh_highlow_all_users[chrome-performance_glitch_user] 32.71
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Test.allTheThings() T-Shirt (Red)', 'Sauce Labs Onesie', 'Sauce Labs Fleece Jacket', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Bike Light', 'Sauce Labs Backpack'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)']
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_sort_items_az_za_lowhigh_highlow_all_users[firefox-standard_user] 12.74
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Test.allTheThings() T-Shirt (Red)', 'Sauce Labs Onesie', 'Sauce Labs Fleece Jacket', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Bike Light', 'Sauce Labs Backpack'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)']
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_sort_items_az_za_lowhigh_highlow_all_users[firefox-performance_glitch_user] 32.71
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)'] ['Test.allTheThings() T-Shirt (Red)', 'Sauce Labs Onesie', 'Sauce Labs Fleece Jacket', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Bike Light', 'Sauce Labs Backpack'] ['Sauce Labs Backpack', 'Sauce Labs Bike Light', 'Sauce Labs Bolt T-Shirt', 'Sauce Labs Fleece Jacket', 'Sauce Labs Onesie', 'Test.allTheThings() T-Shirt (Red)']
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_product_cart_new_page[chrome-standard_user] 0.43
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_product_cart_new_page[chrome-performance_glitch_user] 5.28
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_product_cart_new_page[firefox-standard_user] 0.20
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_product_cart_new_page[firefox-performance_glitch_user] 5.27
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_return_from_itempage[chrome-standard_user] 0.25
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_return_from_itempage[chrome-performance_glitch_user] 10.30
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_return_from_itempage[firefox-standard_user] 0.24
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_return_from_itempage[firefox-performance_glitch_user] 10.31
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_names[chrome] 0.23
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_names[firefox] 0.20
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_desc[chrome] 0.24
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_desc[firefox] 0.25
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_price[chrome] 0.21
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_price[firefox] 0.22
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_img[chrome] 0.21
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_compare_item_img[firefox] 0.19
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_inventory_page.py::test_check_item_info[chrome] 0.33
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[chrome--] 0.13
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[chrome-standartUser-secret_sauce] 0.15
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[chrome-standard_user-secretsauce] 0.13
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[chrome-standard_user-] 0.12
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[chrome--secret_sauce] 0.13
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[chrome-locked_out_user-secret_sauce] 0.15
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[firefox--] 0.11
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[firefox-standartUser-secret_sauce] 0.14
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[firefox-standard_user-secretsauce] 0.15
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[firefox-standard_user-] 0.12
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[firefox--secret_sauce] 0.12
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_negativ_signin[firefox-locked_out_user-secret_sauce] 0.14
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_signin_using_a_list_of_credentials[chrome-standard_user] 0.20
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_signin_using_a_list_of_credentials[chrome-performance_glitch_user] 5.16
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_signin_using_a_list_of_credentials[firefox-standard_user] 0.16
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_signin_using_a_list_of_credentials[firefox-performance_glitch_user] 5.30
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_logout[chrome-standard_user-secret_sauce] 0.89
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_logout[chrome-problem_user-secret_sauce] 0.37
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_logout[chrome-performance_glitch_user-secret_sauce] 5.42
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_logout[firefox-standard_user-secret_sauce] 0.35
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_logout[firefox-problem_user-secret_sauce] 0.34
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_login_page.py::test_logout[firefox-performance_glitch_user-secret_sauce] 5.36
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_about_page_all_users[chrome-standard_user] 5.67
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_about_page_all_users[chrome-performance_glitch_user] 14.97
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_about_page_all_users[firefox-performance_glitch_user] 13.08
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_widget_FB[chrome] 4.18
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_mp_presence_copywriter_robot[chrome] 1.01
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
IMG Present_True
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_mp_presence_copywriter_robot[firefox] 0.87
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
IMG Present_True
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_pp_social_logo[chrome] 0.72
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_pp_social_logo[firefox] 0.81
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_cart_page_copywriter[chrome] 0.88
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
Image is visible on screen
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****
Passed tests/test_widgets.py::test_cart_page_copywriter[firefox] 0.85
-----------------------------Captured stdout setup------------------------------
***** start fixture = setup *****
------------------------------Captured stdout call------------------------------
Image is visible on screen
----------------------------Captured stdout teardown----------------------------
***** end fixture = teardown *****